package com.gitee.huanminabc.db_freedom.wrapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

@EqualsAndHashCode(callSuper = true)
public  abstract class AbstractBaseWrapper<T, Children extends AbstractBaseWrapper<T, Children>> extends Wrapper<T> implements SqlWrapper<T> ,  Cloneable, Serializable {
    protected final Children typedThis = (Children) this; //对象本身
    protected SQL sql=new SQL();
    public AbstractBaseWrapper() {
    }
    public AbstractBaseWrapper( SQL sql) {
        this.sql.set(sql);//这样保证了sql的引用不变
    }

    @Override
    public SQL SQL() {
        return sql;
    }

    @Override
    @SuppressWarnings("all")
    public Children clone() {
        return SerializationUtils.clone(typedThis);
    }


}
